#ifndef __COMPARE_H__
#define __COMPARE_H__
#include <stdint.h>
#include <unistd.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief compare hex h1 and h2
 * @note  n must less than the length of min(h1, h2)
 * @param h1 [in]: the first hex need to compare
 * @param h2 [in]: the second hex need to compare
 * @param n  [in]: the number of comparision hex
 * @return int 0, equal; < 0, h1 < h2; > 0, h1 > h2
 */
extern int compare_hex(const uint8_t *h1, const uint8_t *h2, int n);

/**
 * @brief compare string s1 and s2
 * 
 * @param s1 [in]: the first string need to compare
 * @param s2 [in]: the second string need to compare
 * @return int 0, equal; < 0, s1 < s2; > 0, s1 > s2
 */
extern int compare_str(const char *s1, const char *s2);

/**
 * @brief compare string s1 and s2 ignore case sensitivity
 * 
 * @param s1 [in]: the first string need to compare
 * @param s2 [in]: the second string need to compare
 * @return int 0, equal; < 0, s1 < s2; > 0, s1 > s2
 */
extern int compare_str_ignore_case(const char *s1, const char *s2);

/**
 * @brief compare string s1 and s2
 * 
 * @param s1 [in]: the first string need to compare
 * @param s2 [in]: the second string need to compare
 * @param n  [in]: the number of comparision characters
 * @return int 0, equal; < 0, s1 < s2; > 0, s1 > s2
 */
extern int compare_nstr(const char *s1, const char *s2, int n);

/**
 * @brief compare string s1 and s2 ignore case sensitivity
 * 
 * @param s1 [in]: the first string need to compare
 * @param s2 [in]: the second string need to compare
 * @param n  [in]: the number of comparision characters
 * @return int 0, equal; < 0, s1 < s2; > 0, s1 > s2
 */
extern int compare_nstr_ignore_case(const char *s1, const char *s2, int n);

#ifdef __cplusplus
}
#endif

#endif // __COMPARE_H__
